﻿<wpfui:UiPage
    x:Class="LenovoLegionToolkit.WPF.Pages.AutomationPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:LenovoLegionToolkit.WPF.Controls"
    xmlns:resources="clr-namespace:LenovoLegionToolkit.WPF.Resources"
    xmlns:utils="clr-namespace:LenovoLegionToolkit.WPF.Utils"
    xmlns:wpfui="http://schemas.lepo.co/wpfui/2022/xaml"
    Title="{x:Static resources:Resource.AutomationPage_Title}"
    FlowDirection="{x:Static utils:LocalizationHelper.Direction}">

    <Grid Margin="0,0,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <wpfui:DynamicScrollViewer x:Name="_scrollViewer" Grid.Row="0">
            <Grid Margin="0,0,16,12">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <StackPanel Grid.Row="0" Margin="0,24,0,24">

                    <TextBlock
                        FontSize="24"
                        FontWeight="Medium"
                        Text="{x:Static resources:Resource.AutomationPage_Actions_Title}" />

                    <TextBlock Margin="0,8,0,0" Text="{x:Static resources:Resource.AutomationPage_Actions_Message}" />
                </StackPanel>

                <controls:LoadableControl
                    x:Name="_loaderAutomatic"
                    Grid.Row="1"
                    ContentVisibilityWhileLoading="Collapsed">
                    <StackPanel>

                        <wpfui:CardControl Margin="0,0,0,24">
                            <wpfui:CardControl.Header>
                                <controls:CardHeaderControl Title="{x:Static resources:Resource.AutomationPage_ActionsEnabled_Title}" Subtitle="{x:Static resources:Resource.AutomationPage_ActionsEnable_Message}" />
                            </wpfui:CardControl.Header>
                            <wpfui:ToggleSwitch
                                x:Name="_enableAutomaticPipelinesToggle"
                                Margin="0,0,0,8"
                                Click="EnableAutomaticPipelinesToggle_Click" />
                        </wpfui:CardControl>

                        <TextBlock
                            x:Name="_noAutomaticActionsText"
                            Margin="0,16,0,16"
                            HorizontalAlignment="Center"
                            FontWeight="Medium"
                            Foreground="{DynamicResource TextFillColorSecondaryBrush}"
                            Text="{x:Static resources:Resource.AutomationPage_Actions_Empty}" />

                        <StackPanel x:Name="_automaticPipelinesStackPanel" />

                        <StackPanel Margin="0,8,0,0" HorizontalAlignment="Right">
                            <wpfui:Button
                                x:Name="_newAutomaticPipelineButton"
                                MinWidth="120"
                                Appearance="Primary"
                                Click="NewAutomaticPipelineButton_Click"
                                Content="{x:Static resources:Resource.AddNew}" />
                        </StackPanel>

                    </StackPanel>
                </controls:LoadableControl>

                <StackPanel Grid.Row="2" Margin="0,24,0,24">

                    <TextBlock
                        FontSize="24"
                        FontWeight="Medium"
                        Text="{x:Static resources:Resource.AutomationPage_QuickActions_Title}" />

                    <TextBlock Margin="0,8,0,0" Text="{x:Static resources:Resource.AutomationPage_QuickActions_Message}" />

                </StackPanel>

                <controls:LoadableControl
                    x:Name="_loaderManual"
                    Grid.Row="3"
                    ContentVisibilityWhileLoading="Collapsed">
                    <StackPanel>

                        <TextBlock
                            x:Name="_noManualActionsText"
                            Margin="0,16,0,16"
                            HorizontalAlignment="Center"
                            FontWeight="Medium"
                            Foreground="{DynamicResource TextFillColorSecondaryBrush}"
                            Text="{x:Static resources:Resource.AutomationPage_QuickActions_Empty}" />

                        <StackPanel x:Name="_manualPipelinesStackPanel" />

                        <StackPanel Margin="0,8,0,0" HorizontalAlignment="Right">
                            <wpfui:Button
                                MinWidth="120"
                                Appearance="Primary"
                                Click="NewManualPipelineButton_Click"
                                Content="{x:Static resources:Resource.AddNew}" />
                        </StackPanel>

                    </StackPanel>
                </controls:LoadableControl>

            </Grid>
        </wpfui:DynamicScrollViewer>

        <StackPanel
            x:Name="_saveRevertStackPanel"
            Grid.Row="1"
            Margin="12"
            HorizontalAlignment="Right"
            Orientation="Horizontal"
            Visibility="Collapsed">

            <wpfui:Button
                x:Name="_saveButton"
                MinWidth="120"
                Appearance="Primary"
                Click="SaveButton_Click"
                Content="{x:Static resources:Resource.Save}" />
            <wpfui:Button
                MinWidth="120"
                Margin="12,0,0,0"
                Click="RevertButton_Click"
                Content="{x:Static resources:Resource.Revert}" />

        </StackPanel>

    </Grid>

</wpfui:UiPage>
